define(function(require, exports) {
			var $ = require('commplugin/jquery');
			require('commplugin/jqtemplate')($);
			require('commplugin/bootstrap')($);
			require('commplugin/jquery.form')($);
			require('commplugin/jquery.validata')($);
			var base = require('base/base');
			var util = base.util;
			var config = base.config;
			var action = {};
			action.login="loginValidate";
			
			var loginVal = {
					debug : true,
					rules : {
						loginEmail : {
							required : true,
							email : true,
							maxlength : 26
						},
						loginPassWord : {
							required : true,
							rangelength : [6, 20]
						}
						
					},
					messages : {
						loginEmail : {
							required : "医生账号不能为空",
							email : "医生账号格式必须为email格式，例如：abc@def.com",
							maxlength : "医生账号最长为26位字符"
						},
						loginPassWord : {
							required : "密码账号不能为空",
							rangelength : "密码长度必须为6~20位"
						}
					
					},
					errorElement : 'span',
					ignore : '.ignore'
				}
			
			
			exports.init = function(view) {
				
			//表单绑定事件	
			 var formOpt = util.ajaxFormOpt({
			 			url:action.login,
			 			beforeSubmit:function(formData, jqForm, options){
			 				//在提交表单之前验证表单元素
			 				var valid = $('#registerForm').validate(loginVal);
							if (!valid.form()) {
								return false;
							}
							//改变提交按钮状态
							$("#submit").button("loading");
						},
						success : function(rs) {
							if (rs.code === 1) {
								// 登陆成功处理
								location.href = "index.html";
							} else {

							}
						}
					})
		     $('#loginForm').ajaxForm(formOpt); 
				
			};

		});
		
